Skip to content

CLI: Initial support for volume commands#40139

Open
AmelBawa-msft wants to merge 14 commits intofeature/wsl-for-appsfrom
user/amelbawa/volume
Open

CLI: Initial support for volume commands#40139
AmelBawa-msft wants to merge 14 commits intofeature/wsl-for-appsfrom
user/amelbawa/volume

Conversation

@AmelBawa-msft
Copy link
Copy Markdown

@AmelBawa-msft AmelBawa-msft commented Apr 8, 2026

Summary of the Pull Request

volume create

C:\> wslc volume create --opt SizeBytes=1073741824 demo

Options

Alias Option Description
-d --driver Specify volume driver name (default vhd)
-o --opt Set driver specific options

volume rm

C:\> wslc volume rm demo

volume list

C:\> wslc volume ls

DRIVER   VOLUME NAME
vhd      demo

Options

Alias Option Description
--format Output formatting (json or table) (Default: table)
-q --quiet Outputs the volume names only

volume inspect

C:\> wslc volume inspect demo
[
  {
    "Name": "demo",
    "Type": "vhd",
    "VhdVolume": {
      "HostPath": "C:\\Users\\<USER_NAME>\\AppData\\Local\\wslc\\sessions\\wslc-cli-admin\\volumes\\demo.vhdx",
      "SizeBytes": 1073741824
    }
  }
]

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI review requested due to automatic review settings April 8, 2026 23:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial WSLC CLI support for managing named volumes (create/list/inspect/remove) and validates the new --driver argument, with E2E coverage to ensure named volumes can be used across containers.

Changes:

  • Introduces new wslc volume command group with create/remove/inspect/list subcommands.
  • Adds volume task/service/model plumbing to call existing session COM volume APIs and render output (table/json/quiet).
  • Extends Windows E2E tests to validate named volume persistence across container runs/creates.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/windows/wslc/e2e/WSLCE2EContainerRunTests.cpp Adds E2E scenarios validating named-volume write/read and multi-container persistence with container run.
test/windows/wslc/e2e/WSLCE2EContainerCreateTests.cpp Adds E2E scenarios validating named-volume persistence across container create/start and subsequent containers.
src/windows/wslc/tasks/VolumeTasks.h Declares volume task entry points used by the new commands.
src/windows/wslc/tasks/VolumeTasks.cpp Implements volume tasks: create/delete/list/inspect, including output formatting (table/json/quiet).
src/windows/wslc/services/VolumeService.h / .cpp Adds service wrapper over session COM APIs for volume CRUD/list/inspect.
src/windows/wslc/services/VolumeModel.h Introduces VolumeInformation model for list output + JSON serialization.
src/windows/wslc/core/ExecutionContextData.h Adds Data::Volumes mapping to store volume lists in the execution context.
src/windows/wslc/commands/VolumeCommand.* Adds root volume command and wires up subcommands.
src/windows/wslc/commands/Volume*Command.cpp Implements argument sets, descriptions, validation, and task pipelines for each volume subcommand.
src/windows/wslc/commands/RootCommand.cpp Registers volume under the CLI root.
src/windows/wslc/arguments/ArgumentDefinitions.h Adds VolumeDriver (--driver/-d) and positional VolumeName.
src/windows/wslc/arguments/ArgumentValidation.h / .cpp Adds validation for the --driver argument (currently supports vhd).
localization/strings/en-US/Resources.resw Adds localized help text for volume commands and new arguments.

@benhillis benhillis force-pushed the user/amelbawa/volume branch from f5e1b45 to b851ae9 Compare April 9, 2026 18:45
Copilot AI review requested due to automatic review settings April 14, 2026 04:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 11 comments.

Copilot AI review requested due to automatic review settings April 14, 2026 20:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings April 15, 2026 00:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/windows/wslc/arguments/ArgumentDefinitions.h:1

  • The new argument definitions introduce short-option collisions (-d for both detach and driver, -o for both opt and output). Even if these don’t collide in the current set of per-command args, it prevents combining them in future commands and can be confusing to users. Consider assigning distinct short aliases (or removing the short alias for the less-common arg) to keep the CLI surface unambiguous.
/*++

Copilot AI review requested due to automatic review settings April 15, 2026 00:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

@AmelBawa-msft AmelBawa-msft marked this pull request as ready for review April 15, 2026 00:46
@AmelBawa-msft AmelBawa-msft requested a review from a team as a code owner April 15, 2026 00:46
Copilot AI review requested due to automatic review settings April 15, 2026 01:56
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

src/windows/wslc/arguments/ArgumentDefinitions.h:1

  • This introduces duplicate short-option aliases: -d is used by both Detach and Driver, and -o is used by both opt and output. If the arg parsing/registry expects global uniqueness (common for CLIs), this will cause ambiguous parsing or incorrect ArgType resolution. Use unique short aliases (or NO_ALIAS) for Driver and/or Options, and update help/tests/docs accordingly.
/*++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants